FIG. 1 shows how a typical keyboard matrix 12 is constructed. Two thin sheets 14 and 16 of plastic or polymer material have printed conductive traces 18 and 20, respectively. The traces 18 and 20 are arranged such that when pressure is applied at certain locations, such as when keys 22 on a keyboard are pressed, one trace on sheet 14 makes an electrical connection with one trace 20 at the corresponding location on the other sheet 16.
Typically, the sheets 14 and 16 are separated by a third sheet 24 with no printed traces. The third sheet 24 includes holes 26 aligned with the positions of buttons 22. When no pressure is applied to the area above the holes 26, the conductive traces 18 and 20 do not make contact. When one of the keys 22 is pressed, one of the traces 18 on sheet 14 is pushed through the corresponding hole 26 making an electrical contact with one of the traces 20 on sheet 16. The electrical cross-connection between the trace 18 and the trace 20 is associated with a particular key or button 22. The information associated with the identified key or button 22 is forwarded to a computer, processor, or other computing device.
For clarity, only a small number of row and columns traces are shown in FIG. 1. The traces 18 and 20 on the two printed sheets 14 and 16 are arranged so that each trace 18 on the upper sheet 14 crosses each trace 20 on the lower sheet 16 over a hole 26 only once. In this way, each button 22 on the keyboard will make a single unique contact between one of the traces 18 on the upper sheet 14 and one of the traces 20 on the lower sheet 16. Typically, one sheet has eight traces referred to as key matrix rows and the other sheet has between 16 and 24 traces referred to as key matrix columns. In this way, an 8×16–24 key matrix is formed, with each button 22 corresponding to a single cross-connection point in the matrix.
Generally, a metal sheet (usually connected to electrical ground) is placed underneath the bottom sheet 16 in order to provide mechanical rigidity and to help prevent electrostatic discharge events. Since the resistivity of the conductive ink used to print the traces 18 and 20 is quite high, the printed traces are quite wide, typically in the order of around 2 millimeters (mm) wide.
Due to the size of most keyboards, the traces 18 and 20 are also quite long, particularly the row traces which may “zig-zag” back and forth across the length of the keyboard in order to cross each of the column traces. Lengths of over 0.5 meters (m) are common. Because of the relatively high resistivity, the impedance of the traces 18 and 20 may be 10 ohms per square (s), or up to a couple of hundred ohms. The combination of the trace width and length, the thinness of the polymer sheets 14 and 16, and the proximity of the metal grounding sheet creates a significant capacitance in the traces 18 and 20.
Typically, keyboards contain a microcontroller having Input/Output (I/O) pins connected to the row and column traces 18 and 20. The microcontroller applies signals to the I/O pins and senses the signals on other I/O pins to detect actuation of the keyboard buttons 22. Digital logic or firmware is typically used to execute this process. This arrangement is also used in applications other than keyboards, for example remote controls, where the state of many keys must be detected.
The firmware or logic senses which, if any, buttons 22 are being pressed starts by first connecting a pull-up resistance between each of the row traces and a high voltage, for example 5 volts (V). Typically this resistance is contained within an I/O cell of a Microcontroller Unit (MCU) pin connected to the row traces. The MCU I/O pins connected to the columns are typically held in a high-impedance state. A first column, such as column 0 in FIG. 2 is then driven with a low voltage. The MCU then reads the logic state of the 8 rows for column 0. If all the rows have a logic “1” state, then the firmware infers that no buttons are pressed on the first column 0 of the matrix.
If one or more of the rows have a logic “0” state, the MCU infers that the buttons are pressed corresponding to the cross-connection locations in the matrix corresponding to column 0 and the rows having the logic 0 state. The column 0 is returned to the high impedance state and the process is repeated for each of the remaining columns 1-n. The MCU periodically repeats this entire process driving each column to a known logic state and then scanning each row for the known logic state.
The MCU then also conducts some post processing for any detected key presses. For example, simultaneously pressing three keys located in a right-angled triangle shape relative to each other in the key matrix will cause a fourth “phantom” key press to be detected. The firmware post-processes the list of detected key presses and executes an algorithm to remove any possible “phantom” keys from its list of pressed keys.
The pull-up resistances need to be significantly higher than the impedance of the longest trace so that when one end of the trace is grounded, the output of the voltage divider formed by the trace and pull-up resistor is a low voltage. Typically, pull-up resistances are around 10 thousand (k) ohms.
Because of the significant capacitance of the traces 18 and 20, and relatively high pull-up resistances, the time constant of the formed Resistance/Capacitance (RC) is typically around 10 microseconds (us). After a column pin is driven low, it is therefore necessary to monitor each cross connection in the key matrix for a significant amount of time (t) as shown in FIG. 2. Sometimes this time delay needs to be as much as 100 us to ensure the state of the row I/O pins correctly reflect the state of the associated keys 22 (FIG. 1).
The time required to scan an entire scan 8×20 key matrix used in a typical Personal Computer (PC) keyboard is therefore the time (t) multiplied by the number of columns (n). The total scan time is therefore (n×t) and can be as much as 2 milliseconds (ms). In a normal wired keyboard, where power is provided by the computer attached to the keyboard, this is not a significant problem. However, in battery powered keyboards, particularly wireless keyboards, it is desirable to maximize battery life.
In order to detect and filter key bounce, the key matrix is typically scanned every 10 ms. For a 2 ms total scan period, the MCU therefore performs the matrix scanning algorithm as much as 20% of the time the keyboard is in active use.
A typical wireless keyboard consumes an average of 2–3 milli Amps (mA) when in active use. To save energy, the MCU is placed in a low power sleep mode when not actively scanning the matrix, processing the results of each scan, and transmitting data associated with key presses (if any). The typical current use by the MCU in this type of application is around 3 mA when active (i.e., executing instructions). However, the current use is negligible while in the sleep mode. Thus, the average current attributable to the process of scanning the matrix is around 600 uA (20% of 3 mA). This amounts to 20–30% of the overall current consumption of the keyboard.
These existing methods of keyboard matrix scanning are slow, consume too much power, and prevent the MCU from performing other tasks for a significant period of time while scanning the matrix. The present invention addresses this and other problems associated with the prior art.